using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Auto.Data.HumanResource;
using Auto.Components;

namespace BaseSystem._System
{
    public partial class SearchDiv : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitPage();
            }
        }
        private void InitPage()
        {
            Division div = new Division();
            DataTable dt = div.GetList("");
            this.UcTrees1.SetTreesData(dt, Division.FIELD_DivID, Division.FIELD_DivName, Division.FIELD_ParentID, Division.FIELD_DivID, Division.FIELD_DivName);
            this.UcTrees1.TreeInitIncludeParent();
        }

        protected void btnGetValue_Click(object sender, EventArgs e)
        {
            string result = string.Empty;
            foreach (KeyValuePair<string, string> keyPair in this.UcTrees1.GetCheckedLeafNodes)
            {
                result += keyPair.Key + ",";
            }
            Jscript.AjaxRunJs(this, string.Format("SetOpenerValue('{0}','{1}');", Request.QueryString["TextBoxID"], result.TrimEnd(',')));
        }
    }
}
